Techniques for indirect data prefetching

ABSTRACT

A processor includes a first address translation engine, a second address translation engine, and a prefetch engine. The first address translation engine is configured to determine a first memory address of a pointer associated with a data prefetch instruction. The prefetch engine is coupled to the first translation engine and is configured to fetch content, included in a first data block (e.g., a first cache line) of a memory, at the first memory address. The second address translation engine is coupled to the prefetch engine and is configured to determine a second memory address based on the content of the memory at the first memory address. The prefetch engine is also configured to fetch (e.g., from the memory or another memory) a second data block (e.g., a second cache line) that includes data at the second memory address.

This invention was made with United States Government support underAgreement No. HR0011-07-9-0002 awarded by DARPA. The Government hascertain rights in the invention.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is related to the following commonly assignedpatent applications: U.S. patent application Ser. No. 12/024,186,entitled “TECHNIQUES FOR DATA PREFETCHING USING INDIRECT ADDRESSING” byRavi K. Arimilli et al.; U.S. patent application Ser. No. 12/024,246,entitled “TECHNIQUES FOR DATA PREFETCHING USING INDIRECT ADDRESSING WITHOFFSET” by Ravi K. Arimilli et al.; U.S. patent application Ser. No.12/024,248, entitled “TECHNIQUES FOR PREDICTION-BASED INDIRECT DATAPREFETCHING” by Ravi K. Arimilli et al.; and U.S. patent applicationSer. No. 12/024,260, entitled “TECHNIQUES FOR MULTI-LEVEL INDIRECT DATAPREFETCHING” by Ravi K. Arimilli et al., all of which were filed on evendata herewith and are incorporated herein by reference in their entiretyfor all purposes.

BACKGROUND

1. Field

This disclosure relates generally to data prefetching and, morespecifically to techniques for indirect data prefetching.

2. Related Art

Data prefetch (cache management) instructions, which have used directaddressing, have been employed to move data into a cache before the datais accessed in an attempt to minimize cache-miss latency. Data prefetchinstructions (which may be added to software by a compiler orprogrammer) are generally treated as hints, which affect softwareperformance but not software functionality. Hints can be used to movedata into a given cache level in an attempt to provide a desiredperformance. Prefetched data in a same cache line as desired data hasspatial locality and has a high probability of being accessed in thenear future. Data with temporal locality, or persistence, is expected tobe accessed multiple times and should generally be maintained in a cachefor ready accessibility. Accesses to data with no temporal locality aretransient and, as such, data with no temporal locality should generallybe removed from a cache after use to provide room in the cache for otherdata.

Some data prefetch instructions allow for specifying a cache level inwhich data should be stored. Various data prefetch instructions make adistinction between memory which is expected to be read and memory whichis expected to be written. When data is to be written, a data prefetchinstruction usually moves a data block into a cache so that an expectedstore is to the cache. A prefetch for a write generally brings data intoa cache in an exclusive or modified state. A prefetch for data to bewritten can usually be replaced with a prefetch for data to be read(this is usually how implementations that define both kinds ofinstructions, but do not support prefetch for writes, operate). A datablock accessed by a data prefetch instruction usually corresponds to acache line, whose size is implementation specific. Various architecturesimplement data prefetch instructions with a base update form, whichmodifies a prefetch address following a prefetch. Base update (pre/postincrement/decrement) is also supported on load and store instructionsfor some architectures and can be taken into consideration in code thatuses data prefetch instructions.

Some architectures implement data prefetch instructions that causefaults when the address to prefetch is invalid or not cacheable. Ingeneral, data should be in a cache prior to being accessed. However,using prefetches that are too speculative can have negative affects asthere are costs associated with data prefetch instructions. Similarly,prefetching data that is already in the cache increases overhead withoutproviding any benefit. For example, data may already be in a cache whenthe data is in the same cache line as data already prefetched (spatiallocality) or if the data has been used recently (temporal locality).Some architectures recognize data prefetch instructions but treat themas no operation (nop) instructions. Usually, data prefetch instructionsare ignored for memory pages that are not cacheable. However, a baseaddress of a data prefetch instruction that has a base update form maybe updated even if addressed memory cannot be prefetched.

SUMMARY

According to one aspect of the present disclosure, a processor includesa first address translation engine, a second address translation engine,and a prefetch engine. The first address translation engine isconfigured to determine a first memory address of a pointer associatedwith a data prefetch instruction. The prefetch engine is coupled to thefirst translation engine and is configured to fetch content, included ina first data block (e.g., a first cache line) of a memory, at the firstmemory address. The second address translation engine is coupled to theprefetch engine and is configured to determine a second memory addressbased on the content of the memory at the first memory address. Theprefetch engine is also configured to fetch (e.g., from the memory oranother memory) a second data block (e.g., a second cache line) thatincludes data at the second memory address. A data prefetch instructionmay be indicated by a unique operational code (opcode), a uniqueextended opcode, or a field (including one or more bits) in aninstruction.

According to another aspect of the present disclosure, a technique forperforming data prefetching using indirect addressing (indirect dataprefetching) includes determining a first memory address of a pointerassociated with a data prefetch instruction. A first data block (e.g., afirst cache line) that includes multiple elements (one of which includescontent of a memory at the first memory address) is then fetched.Respective second memory addresses are determined for at least two ofthe multiple elements. Respective second data blocks (e.g., respectivesecond cache lines) for each of the respective second memory addressesare then fetched (e.g., from the memory or another memory).

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example and is notintended to be limited by the accompanying figures, in which likereferences indicate similar elements. Elements in the figures areillustrated for simplicity and clarity and have not necessarily beendrawn to scale.

FIG. 1 is a diagram of an example processor system that may beconfigured according to various aspects of the present disclosure.

FIG. 2 is a diagram of an example data prefetch instruction that may beemployed in the processor system of FIG. 1, according to variousembodiments of the present disclosure.

FIG. 3 is a flowchart of an example process for performing dataprefetching using indirect addressing (indirect data prefetching),according to one aspect of the present disclosure.

FIG. 4 is a flowchart of an example process for performing indirect dataprefetching for multiple elements of a data block, according to anotheraspect of the present disclosure.

FIG. 5 is a diagram of a relevant portion of a processor that includes aprefetch engine and an example load store unit (LSU) configuredaccording to one aspect of the present disclosure.

FIG. 6 is a diagram of a relevant portion of an example prefetch engine,such as the prefetch engine of FIG. 5.

FIG. 7 is a flowchart of an example process for performing dataprefetching by monitoring data pointer values, associated with an array,in an access stream to a memory, according to one aspect of the presentdisclosure.

FIG. 8 is a flowchart of an example process for performing multi-levelindirect data prefetching according to an aspect of the presentdisclosure.

DETAILED DESCRIPTION

As will be appreciated by one of ordinary skill in the art, the presentinvention may be embodied as a method, system, device, or computerprogram product. Accordingly, the present invention may take the form ofan entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, microcode, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”The present invention may, for example, take the form of a computerprogram product on a computer-usable storage medium havingcomputer-usable program code, e.g., in the form of one or more designfiles, embodied in the medium.

Any suitable computer-usable or computer-readable storage medium may beutilized. The computer-usable or computer-readable storage medium maybe, for example, but is not limited to, an electronic, magnetic,optical, electromagnetic, infrared, or semiconductor system, apparatus,or device. More specific examples (a non-exhaustive list) of thecomputer-readable storage medium would include the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory(EPROM) or flash memory, a portable compact disc read-only memory(CD-ROM), an optical storage device, or a magnetic storage device. Asused herein the term “coupled” includes a direct electrical connectionbetween elements or blocks and an indirect electrical connection betweenelements or blocks achieved using one or more intervening elements orblocks.

Traditionally, data prefetch instructions have employed directaddressing. Unfortunately, for many high performance computing (HPC)applications (e.g., computational fluid dynamics and building andtesting virtual prototypes), employing direct addressing for dataprefetch instructions may not provide a desired performance level. Forexample, as programmers gravitate to employing higher-level languages(e.g., Java and X10) data addressing is increasingly utilizingobject-oriented mechanisms that frequently implement indirectaddressing. In this case, prefetch engines of conventional processorsstall when referenced data is based on prefetched data (i.e., whenindirect addressing is employed).

According to one or more aspects of the present disclosure, instructionset architecture (ISA) support for data prefetching using indirectaddressing is implemented by employing a data prefetch instruction(e.g., a load instruction) whose return data is a pointer to data ofinterest. In general, programs are written using effective addresses(EAs), while caches and main memory are accessed utilizing realaddresses (RAs). As such, address translation is required to convert theEAs (used by software) to RAs (used by hardware). For example, invarious PowerPC™ architectures a segment table (located in a segmentlookaside buffer (SLB)) and hashed page table (located in a translationlookaside buffer (TLB)) have been employed to translate EAs (used bysoftware) into RAs (used by hardware) to locate data in storage. Aftertranslation, an EA and RA pair may be stored in an effective-to-realaddress translation (ERAT) buffer to reduce latency associated withaccessing data in storage. In general, an ERAT table (stored in the ERATbuffer) may be accessed (indexed) using an EA associated with a dataprefetch instruction. It should be appreciated that the techniquesdisclosed herein are equally applicable to architectures that convert anEA to an RA without first converting the EA to a virtual address (VA).

With reference to FIG. 1, an example processor system 100 is illustratedthat may employ data prefetching using indirect addressing according toone or more of the techniques disclosed herein. The example processorsystem 100 includes two chip-level multiprocessors (CMPs) 102, each ofwhich includes two processors 104. The processors 104 may, for example,operate in a simultaneous multithreading (SMT) mode or a single thread(ST) mode. When the processors 104 are operating in the SMT mode, theprocessors 104 may employ multiple separate instruction fetch addressregisters to store program counters for multiple threads. In at leastone embodiment, the processors 104 each include a first level (L1) cachememory (not separately shown) that is coupled to a shared second level(L2) cache memory (cache) 106, which is coupled to a shared third level(L3) cache 114 and a fabric controller 108. As is illustrated, thefabric controller 108 is coupled to a memory controller 110, which iscoupled to a memory subsystem 112. The memory subsystem 112 includes anapplication appropriate amount of volatile and non-volatile memory. Thefabric controller 108 facilitates communication between different onesof the CMPs 102 and between the processors 104 and the memory subsystem112 and in this manner functions as an interface.

According to various aspects of the present disclosure, a data prefetchinstruction (e.g., an enhanced load instruction) is provided thatindicates that return data is a pointer to desired data of interest (ora pointer to a pointer to desired data of interest, etc.). In this case,the data prefetch instruction can be configured to include a field(including one or more bits) that indicates that return data at aspecified address is a pointer to desired data, as well as indicating anumber of indirect addressing levels employed). Alternatively, an opcodeor extended opcode may be employed to indicate that an instruction is anindirect data prefetch instruction, as well as a number of indirectaddressing levels. In one or more embodiments, a load store unit (LSU)of a processor is configured to first fetch a pointer (e.g., a four byteor eight byte pointer) from a real address (RA) associated with aneffective address (EA) specified in an indirect data prefetchinstruction (e.g., an indirect load instruction or an indirect storeinstruction). In one or more embodiments, after fetching the pointer,the LSU treats the pointer (return data) as an EA. The EA is thentranslated by the LSU to determine an RA (associated with a lower levelcache and/or main memory) from which to fetch desired data.

For example, with reference to FIG. 2, when an indirect load instruction(ldi RT, RX, RY) 200 is executed, the LSU first calculates a pointerlocation (PL) by adding content of register ‘X’ and register ‘Y’ (i.e.,PL=RX+RY) to determine an EA of the pointer, which is stored in theregister ‘T’. The LSU then translates the EA of the PL to an associatedRA and fetches content (at the RA) from a lower level cache or mainmemory. In this case, the LSU treats the fetched data as a second EA fora desired data location (DL). In this embodiment, the LSU thentranslates the second EA to a second RA and then sends the second RA toa lower level cache or main memory to fetch desired data (in anassociated data block) for transfer to a data cache (e.g., a level 1(L1) cache, a level 2 (L2) cache, or level 3 (L3) cache). In the aboveexample, RT, RX, and RY are register file addresses (e.g., in variousPowerPC™ implementations, RT, RX, and RY can range from 0 to 31, but inother processors the range can be higher or lower). Instead of providingthe registers RX and RY to calculate the first address, the firstaddress may be provided in various other manners (e.g., directly throughan absolute addressing mechanism or through indexing).

With reference to FIG. 3, a flowchart of an example process 300 forperforming data prefetching using indirect addressing (indirect dataprefetching) according to an embodiment of the present disclosure isillustrated. In block 302 the process 300 is initiated, at which pointcontrol transfers to block 304. In block 304, a first memory address ofa pointer associated with a data prefetch instruction is determined. Inone implementation, determining the first memory address includescalculating a first EA of the pointer, translating the first EA to afirst VA (e.g., using an SLB), and translating the first VA to a firstRA (e.g., using a TLB) that corresponds to the first memory address. Inanother implementation, determining the first memory address includescalculating a first EA of the pointer and translating the first EA to afirst RA (e.g., using an ERAT or other mechanism) that corresponds tothe first memory address.

Next, in block 306, content of a memory at the first memory address isfetched. The memory may be a lower level cache (e.g., a second level(L2) cache, a third level (L3) cache, etc.) or main memory. Then, inblock 308, a second memory address is determined from the content of thememory at the first memory address. In one implementation, determiningthe second memory address includes calculating a second EA of thecontent of the memory at the first memory address, translating thesecond EA to a second VA, and translating the second VA to a second RAthat corresponds to the second memory address. In anotherimplementation, determining the second memory address includescalculating a first EA of the content of the memory at the first memoryaddress and translating the first EA to a first RA that corresponds tothe first memory address. Next, in block 310, a data block (e.g., acache line) including data at the second memory address is fetched forinclusion in a cache (which may be a first level (L1) cache, an L2cache, an L3 cache, etc. that functions as a data cache or a shared(data and instruction) cache). Following block 310 control transfers toblock 312 where the process 300 terminates.

According to another aspect of the present disclosure, one or moreaddress translation engines are implemented within a processor chip tocalculate indirect addresses. For example, a translation engine mayexecute microcode to calculate a target of an indirect access. Forindirect address prefetching for A[B[I]+O], as seen by a program (e.g.,a Fortran or C program), an LSU may be configured to prefetch a datablock (e.g., a cache line) containing B[I] and store the data block in adata (or shared) cache (or a separate scratch register). Assuming a datablock corresponds to a cache line and each cache line containsone-hundred twenty-eight bytes and 64-bit addressing is employed, eachaddress requires eight bytes. In a typical embodiment, B[I] may be a32-bit or a 64-bit index added to an offset “O” that is a 64-bitaddress. Depending on whether B[I] elements are four bytes or eightbytes, there are thirty-two or sixteen elements in a fetched cache linethat includes B[I], respectively. In one or more embodiments, an LSU isconfigured to include logic (e.g., a state machine) that walks throughthe elements in the cache line and computes B[I]+O to determine EAs forA[B[I]+O]. In this case, the LSU performs address translations todetermine the RAs, which are sent to a lower level cache or main memoryto prefetch data cache lines to a data (or shared) cache. In thismanner, successive loads to A[B[I]+O] are usually cache-hits and, inthis case, cache-miss penalties are avoided.

With reference to FIG. 4, an example process 400 is illustrated thatperforms indirect data prefetching according to another aspect of thepresent disclosure. The process 400 is initiated in block 402, at whichpoint control transfers to block 404. In block 404, a first memoryaddress of a pointer associated with a data prefetch instruction isdetermined. Next, in block 406, a first data block (e.g., a first cacheline) including multiple elements (one of which includes content of amemory at the first memory address) is fetched. Then, in block 408,respective second memory addresses are determined for at least two ofthe multiple elements. The second memory addresses may, or may not,include an offset. Depending on where the process 400 is implemented(LSU or memory controller), when an offset is included, the offset maybe added to an EA prior to translation to an RA (LSU) or the offset maybe added to an RA after translation (cache or memory controller),assuming a page boundary is not crossed. Next, in block 410, respectivesecond data blocks (respective second cache lines) for each of therespective second memory addresses are fetched from the memory accordingto an implemented process. Following block 410, control transfers toblock 412, where the process 400 terminates.

As is described herein, for data prefetching using indirect addressing,address translation is performed at least twice. For example, in oneembodiment, an address translation engine first determines a first RAfrom a first EA, which is RX+RY in the above-example. Once returned dataassociated with the first RA is received at the LSU, the LSU translatesthe returned data (a new EA) to a new RA. To improve efficiency andprovide higher translation bandwidth, an LSU may be configured toinclude two or more address translation engines. In this case, a secondaddress translation engine may be coupled to an additional port of asegment lookaside buffer (SLB) and an additional port of a translationlookaside buffer (TLB). The second address translation engine may alsobe coupled to an additional port of a data effective-to-real addresstranslation (D-ERAT) buffer, which summarizes tables in the SLB and theTLB buffers. The additional ports allow a new EA to be translated by thesecond address translation engine, while a first address translationengine is available to translate other indirect data prefetchinginstructions (e.g., load/store instructions).

With reference to FIG. 5, a relevant portion of the processor 104 isshown as including an LSU 502 that includes a first address translationunit 504 and a second translation unit 506 each of which are coupled toa prefetch engine 516. A state machine (SM) 514, as noted above, isincluded to walk through elements in a cache line to compute B[I]+O foreach element in the cache line to determine EAs when an offset isemployed. The unit 504 is coupled to a first port of SLB 510, a firstport of TLB 512, and a first port of ERAT 508. Similarly, the unit 506is coupled to a second port of the SLB 510, a second port of the TLB512, and a second port of the ERAT 508. In this configuration, the units504 and 506 can simultaneously access the SLB 510 and the TLB 512 or theERAT 508 and, in this manner, perform two address translationssimultaneously.

According to another aspect of the present disclosure, a prefetch unitis configured to support indirect addressing with register offset. Inthis embodiment, the prefetch unit calculates a target address utilizingan offset included in a general purpose register (GPR) or otherprocessor register. In this case, desired data to be fetched throughindirect data prefetching is not at the PL, but is at an offset from thePL. The offset can be specified in various manners in a programmingenvironment. For example, the offset can be specified through a specialpurpose register (SPR) in a processor core, caches, or memory. As otherexamples, the offset can be specified as a new address field in theprefetch instruction or as a new register field in a prefetchinstruction. As another example, the offset can be specified in aparticular GPR location, as indicated by an opcode field of theinstruction (e.g., a new data prefetch instruction opcode may specifythat content of GPR0 should be treated as offset “O” to computeA[B[I]+O].

In a typical implementation, an LSU handles the offset for the followingcases: when the offset is specified in the instruction (either through anew register field or a new address field); when the offset is specifiedin a particular GPR as indicated by the instruction opcode; and when theoffset is specified by an SPR, which is maintained by the processorcore. If the LSU handles the offset, then the LSU adds the offset to thePL before performing the EA to RA translation. After adding the offset,the LSU performs the EA to RA translation and then brings the prefetchdata to a target processor register. When a memory subsystem isconfigured to handle an offset, the offset may be specified by an SPRthat is maintained by a cache controller or memory controller. In thiscase, the cache or memory controller adds the offset to the RA followingthe EA to RA translation and before desired data is accessed from alower level cache or main memory.

According to another aspect of the present disclosure, a prefetch engineis configured to include logic to detect indirect data prefetch streams(based upon access history) and prefetch targets of subsequent accessesin a memory access stream. In this case, a programmer is not required toemploy hints to specify indirect prefetching addresses and offsets. Assuch, configuring a processor to detect indirect prefetching streams,while increasing hardware complexity, generally simplifies programming.Moreover, when a programmer attempts to specify indirect data prefetchstreams and misses one or more of the streams, a prefetch engineconfigured to detect a stream of indirect address accesses to memorydetects the missed indirect data prefetching streams. As employing dataprefetch instructions in a program only enhances performance, a programruns, with or without performance hints provided by a programmer(however, if the programmer does not provide indirect prefetch hints orprovides wrong information the program may ran slower). A hardwareprefetch mechanism that supports indirect addressing may be maintainedin one or more prefetch tables in a prefetch engine in a processor core.

For indirect prefetching, such as A[B[I]] or A[B[I]+O] (where ‘O’ is afixed offset), a prefetch engine attempts to capture successive valuesof B[I] for all references coming from an array A[ ] and attempts toanticipate a value of B[I] for a next value of “I” (how much the index“I” is incremented from one iteration to the next depends on theprogram). A first address of the array A[ ] may be hashed with anaddress of B[I] to generate an index into the prefetch table. Thehashing may employ bit-wise exclusive OR (XOR) or another hashingscheme. In this case, for the same array A and B, for every new I thereis a new B[I] and a new entry in a prefetch table of the prefetchengine.

For every new load reference to location A[B[I]], the prefetch table maybe accessed, based on the indexing mechanism mentioned above. In atypical implementation, before actual execution of a data prefetch(e.g., a load) operation, the prefetch table is walked through to findsuccessive addresses of A[B[I]]. At the time of execution of the dataprefetch instruction (e.g., a load instruction), if the EA in theindexed entry is found to be different from what was calculated at thetime of prediction for the data prefetch address, the prefetch tableentry is updated (this typically happens when the address is seen forthe first time and the prefetch table is not yet initialized). Theprefetch table can also be maintained in a cache controller or mainmemory controller. In the case where the prefetch table is maintained ina cache or main memory controller, the prefetch table looses itseffectiveness to some extent, as a prefetch stream is terminated at apage boundary.

With reference to FIG. 6, a prefetch engine 516 (that prefetches data bymonitoring data cache-line misses and predicting patterns) isillustrated. When a stream pattern is detected, the prefetch engine 516speculatively prefetches cache lines in anticipation of their use. Inone embodiment, the prefetch engine 516 includes a stream filter (e.g.,a ten-entry first-in first-out (FIFO) buffer) 602 and a streamprefetcher (including a prefetch table) 604. Prefetch guess logic 606observes data cache line misses (provided by load miss queue 610), inthe form of real addresses (RA), to detect potential streams toprefetch. The stream filter 602 records data cache-line miss informationprovided by the logic 606. The logic 606 increments or decrements an RAof a cache line (e.g., depending on an offset within a cache line) andthe “guess” is placed in the stream filter 602.

As new cache misses occur, if the RA of a new cache miss matches one ofthe guessed addresses in the stream filter 602, a stream has beendetected. If a stream prefetch control 608 has fewer than apredetermined number of (e.g., four) streams active, a new stream isinstalled in the stream filter 602 and a prefetch to a cache lineanticipated next in the stream is sent out to memory via a bus interfaceunit (BIU) 620. Once placed in a stream prefetcher 604, a stream usuallyremains active until it is aged out. For example, a stream may be agedout when the stream reaches its end and other cache misses displace thestream entry in the stream filter 602. When a stream is prefetched, theprefetcher 604 attempts to stay ahead of a current cache line (i.e., thecache line whose elements are currently being accessed by a dataprefetch instruction). For example, a next cache line that follows thecurrent cache line may be prefetched into an L1 cache, and a cache linethat follows the next cache line may be prefetched to a prefetch bufferin the BIU 620.

The prefetch engine 516 may be configured to concurrently prefetchmultiple streams, each of which may be one or more cache lines ahead ofa current cache line. The prefetch engine 516 monitors data prefetch(e.g., load) addresses (e.g., EA0 and EA1) from an LSU. According to oneembodiment, when the LSU finishes with a current cache line and advancesto a next cache line (which is already in the L1 cache due toprefetching), the prefetch engine 516 transfers the cache line in theprefetch buffer (in the BIU 620) to the L1 cache and prefetches the nextcache line into the prefetch buffer (in the BIU 620). In this way,prefetching of lines may be paced by a rate at which elements in astream are consumed.

With reference to FIG. 7, a process 700 for performing indirect dataprefetching, according to an embodiment of the present disclosure, isillustrated. In block 702 the process 700 is initiated, at which pointcontrol transfers to block 704. In block 704, data pointer values,associated with an array, are monitored in an access stream associatedwith a memory. Next, in block 706, it is determined whether a patternexists in the data pointer values. Then, in block 708, a prefetch tableis populated with respective entries that correspond to respective arrayaddress/data pointer pairs based on a predicted pattern in the datapointer values. Next, in block 710, respective cache lines areprefetched from the memory based on the respective entries in theprefetch table. For example, a first array address may be hashed with afirst data pointer address associated with the first array to generate afirst index into the prefetch table. In this manner, a first cache line(whose address is associated with the first data pointer address in theprefetch table) may be prefetched. The respective array address/datapointer pairs may be, for example, RAs or EAs. Following block 710,control then transfers to block 712 where the process 700 terminates.

According to another aspect of the present disclosure, a prefetch unitis configured to include logic that performs multi-level prefetching oftargets identified via indirect addressing. Two-level indirectionwithout an offset can be represented as A[B[C[I]] and three-levelindirection without an offset can be represented as A[B[C[D[I]]]]. Ineach level, an offset can also be added. For example, for two-levelindirection with an offset can be represented as A[B[C[I]+O1]+O2], whereO1 and O2 are two different offsets, which may have the same value. Inone or more embodiments, multiple special purpose registers (SPRs) aremaintained for each of the multiple offsets. For two-level indirection,an LSU first does the one-level indirection for B[C[I]+O1]. In thiscase, the LSU creates a first pointer location (PL1), then adds theoffset O1 to the PL1 to provide a first EA and then translates the firstEA to a first RA and fetches the data at the first RA. Instead oftreating the fetched data as the desired data, the LSU treats thefetched data as a second EA for a second pointer location (PL2). The LSUthen computes an EA of A[PL2+O2] to get the final data. In this case,the LSU calculates the EA of A[PL2+O2], translates the EA to a secondRA, fetches a cache line of data that includes the second RA, and placesthe fetched cache line in a data or shared cache.

With reference to FIG. 8, a process 800 for performing multi-levelindirect data prefetching, according to an embodiment of the presentdisclosure, is illustrated. In block 802 the process 800 is initiated,at which point control transfers to block 804. In block 804, a firstmemory address of a pointer associated with a data prefetch instructionis determined. Next, in block 806, a first data block that includescontent at the first memory address is fetched. Then, in block 808, asecond memory address is determined from the content of the first memoryaddress. Next, in block 810, a second data block that includes contentat the second memory address is fetched. Then, in block 812, a thirdmemory address is determined from content of the second memory address.Next, in block 814, a third data block that includes data at the thirdmemory address is fetched. It should be appreciated that additionallevels of indirection may be employed. Following block 814, control thentransfers to block 816 where the process 800 terminates.

Accordingly, various techniques have been disclosed herein that readilyfacilitate implementation of data prefetching using indirect addressingin a processor (e.g., an in-order or out-of-order processor).

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” (and similar terms, such as includes, including,has, having, etc.) are open-ended when used in this specification,specify the presence of stated features, integers, steps, operations,elements, and/or components, but do not preclude the presence oraddition of one or more other features, integers, steps, operations,elements, components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below, if any, areintended to include any structure, material, or act for performing thefunction in combination with other claimed elements as specificallyclaimed. The description of the present invention has been presented forpurposes of illustration and description, but is not intended to beexhaustive or limited to the invention in the form disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the invention.The embodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

Having thus described the invention of the present application in detailand by reference to preferred embodiments thereof, it will be apparentthat modifications and variations are possible without departing fromthe scope of the invention defined in the appended claims.

1. A processor, comprising: a first address translation engineconfigured to determine a first memory address of a pointer associatedwith a data prefetch instruction, wherein the first memory addresscorresponds to an address to which the pointer points; a prefetch enginecoupled to the first address translation engine, wherein the prefetchengine is configured to fetch a first data block that includes contentof a memory at the first memory address; and a second addresstranslation engine coupled to the prefetch engine, wherein the secondaddress translation engine is configured to determine a second memoryaddress based solely on the content of the memory at the first memoryaddress, and wherein the prefetch engine is also configured to fetch asecond data block that includes desired data at the second memoryaddress, where the data prefetch instruction includes an indirectaddress field that identifies whether an effective address associatedwith the data prefetch instruction is a pointer for the desired datathat is to be prefetched or whether the effective address corresponds toan address for the desired data.
 2. The processor of claim 1, whereinthe first address translation engine is further configured to: determinea first effective address of the pointer; translate the first effectiveaddress to a first virtual address; and translate the first virtualaddress to a first real address that corresponds to the first memoryaddress.
 3. The processor of claim 2, wherein the second addresstranslation engine is further configured to: determine a secondeffective address of the content of the memory at the first memoryaddress; translate the second effective address to a second virtualaddress; and translate the second virtual address to a second realaddress that corresponds to the second memory address.
 4. The processorof claim 1, wherein the first address translation engine is furtherconfigured to: determine a first effective address of the pointer; andtranslate the first effective address to a first real address thatcorresponds to the first memory address.
 5. The processor of claim 4,wherein the second address translation engine is further configured to:determine a second effective address of the content of the memory at thefirst memory address; and translate the second effective address to asecond real address that corresponds to the second memory address. 6.The processor of claim 1, wherein the first address translation engineis configured to: access, based on a first effective address, atranslation table via a first port of an effective-to-real addresstranslation buffer; and retrieve, based on the first effective address,the first memory address from the translation table, wherein the firstmemory address is a first real address.
 7. The processor of claim 6,wherein the second address translation engine is configured to: access,based on a second effective address, the translation table via a secondport of the effective-to-real address translation buffer; and retrieve,based on the second effective address, the second memory address fromthe translation table, wherein the second memory address is a secondreal address.
 8. The processor of claim 1, wherein the first addresstranslation engine is further configured to: access, based on a firsteffective address, a segment table via a first port of a segmentlookaside buffer; retrieve, based on the first effective address, afirst virtual address from the segment table; access, based on the firstvirtual address, a hashed page table via a first port of a translationlookaside buffer; and retrieve, based on the first virtual address, thefirst memory address from the hashed page table, wherein the firstmemory address is a first real address.
 9. The processor of claim 8,wherein the second address translation engine is further configured to:access, based on a second effective address, the segment table via asecond port of the segment lookaside buffer; retrieve, based on thesecond effective address, a second virtual address from the segmenttable; access, based on the second virtual address, the hashed pagetable via a second port of the translation lookaside buffer; andretrieve, based on the second virtual address, the second memory addressfrom the hashed page table, wherein the second memory address is asecond real address.
 10. A method of performing indirect dataprefetching, comprising: determining a first memory address of a pointerassociated with a data prefetch instruction, wherein the first memoryaddress corresponds to an address to which the pointer points; fetchinga first data block including multiple elements one of which includescontent of a memory at the first memory address; determining respectivesecond memory addresses for at least two of the multiple elements basedsolely on content of the memory at the at least two of the multipleelements; and fetching respective second data blocks at each of therespective second memory addresses, wherein the data prefetchinstruction includes an indirect address field that identifies whetheran effective address associated with the data prefetch instruction is apointer for desired data that is to be prefetched or whether theeffective address corresponds to an address for the desired data. 11.The method of claim 10, further comprising: adding, prior to fetchingthe respective second data blocks, an offset to each of the multipleelements to provide the respective second memory addresses.
 12. Themethod of claim 10, wherein the determining a first memory addressfurther comprises: determining a first effective address of the pointer;translating the first effective address to a first virtual address; andtranslating the first virtual address to a first real address thatcorresponds to the first memory address.
 13. The method of claim 12,wherein the determining respective second memory addresses furthercomprises: determining respective second effective addresses based oncontent of each of the multiple elements; translating the respectivesecond effective addresses to respective second virtual addresses; andtranslating the respective second virtual addresses to respective secondreal addresses that each correspond to one of the respective secondmemory addresses.
 14. The method of claim 10, wherein the determining afirst memory address further comprises: determining a first effectiveaddress of the pointer; and translating the first effective address to afirst real address that corresponds to the first memory address.
 15. Themethod of claim 14, wherein the determining respective second memoryaddresses further comprises: determining respective second effectiveaddresses based on content of each of the multiple elements; andtranslating the respective second effective addresses to respectivesecond real addresses that each correspond to one of the respectivesecond memory addresses.
 16. The method of claim 10, wherein thedetermining the first memory address includes: accessing, based on aneffective address, a translation table in an effective-to-real addresstranslation buffer; and retrieving, based on the effective address, thefirst memory address from the translation table, wherein the firstmemory address is a real address.
 17. The method of claim 10, whereinthe determining the first memory address includes: accessing, based onan effective address, a segment table in a segment lookaside buffer;retrieving, based on the effective address, a virtual address from thesegment table; accessing, based on the virtual address, a hashed pagetable in a translation lookaside buffer; and retrieving, based on thevirtual address, the first memory address from the hashed page table,wherein the first memory address is a real address.
 18. A method forperforming indirect data prefetching, comprising: determining, using afirst address translation engine, a first memory address of a pointerassociated with a data prefetch instruction, wherein the first memoryaddress corresponds to an address to which the pointer points; fetchinga first data block that includes content of a memory at the first memoryaddress; determining, using a second address translation engine, asecond memory address based solely on the content of the memory at thefirst memory address; and fetching a second data block that includesdesired data at the second memory address, wherein the data prefetchinstruction includes an indirect address field that identifies whetheran effective address associated with the data prefetch instruction is apointer for the desired data that is to be prefetched or whether theeffective address corresponds to an address for the desired data.